<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工程合同详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css">
    <style>
        .details ul li {width: 50%;float: left;}
        .layui-table thead th{text-align: left;}
        thead tr th:before {content: "● "; color: #e3e3e3; font-size: 12px;}
        .layui-table td{text-indent: 1rem; font-size: 12px; color: #333;}
        .detailed{background-color: #FFF; font-size: 12px; color: #333333; padding: 15px 20px; line-height: 24px;margin-top: 15px;}
        /*.details ul,li{list-style: inherit;}*/
        .detailed p:after {
            content: "\0020";
            display: block;
            height: 0;
            clear: both;
        }
        .detailed p:before {content: "● "; color: #e3e3e3; font-size: 12px; margin-right: 5px; float: left;}
        .detailed .detaL{width: 120px;display: inline-block; float: left;    padding-right: 20px;}
        .detailed .dataR{display: inline-block;float: left;}
        .detailed p{margin-bottom: 10px;}
        /*.detailedfoot{margin-bottom: 50px;}*/
        .detailedfoot ul li {width: 50%;float: left;}
        .layui-table thead th{text-align: left;}
        thead tr th:before {content: "● "; color: #e3e3e3; font-size: 12px;}
        .layui-table td{text-indent: 1rem; font-size: 12px; color: #333;}
        .detailedfoot ul li:before{content: '';}
        p .dataR{width: 80%;}
        .layui-btn{position: fixed;top: 5px;}
        .engineering{margin-top: 50px;}
    </style>
</head>
<body>
<form class="layui-form layui-form-pane" action="" >
    <button class="layui-btn" type="button" onclick="history.back(-1);"><i class="layui-icon"></i></button>
    <button class="layui-btn" type="button" onclick="daochu(1)" style="position: fixed;right: 180px;" >打印</button>
    <button class="layui-btn" type="button" onclick="daochu(0)" style="position: fixed;right: 80px;">打印<span class="layui-badge">新</span></button>

    <div class="engineering"><!--工程信息-->
        <div class="titles">郑州建材有限公司</div>
        <div class="details">

        </div>
        <div class="detailed">      <!--工程概括-->

        </div>
        <div class="detailedfoot">
            <!--<ul>-->
                <!--<li><span class='detaL'>建设单位（甲方）：</span><span class="dataR">  </span></li>-->
                <!--<li><span class='detaL'>施工单位（乙方）：</span><span class="dataR">  </span></li>-->
                <!--<li><span class='detaL'>委托代理人：</span><span class="dataR">  </span></li>-->
                <!--<li><span class='detaL'>委托代理人：</span><span class="dataR">  </span></li>-->
                <!--<li><span class='detaL'>日期：</span><span class="dataR">  </span></li>-->
                <!--<li><span class='detaL'>日期：</span><span class="dataR">  </span></li>-->
            <!--</ul>-->
        </div>
    </div>



</form>

<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>
<script>
    function daochu(i) {
        layui.use(['form', 'layedit', 'laydate'], function() {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;


            layer.open({
                type: 2,
                title: '合同打印预览',
                shadeClose: true,
                shade: 0.8,
                area: ['90%', '90%'],
                content: [urls+'/api/print/printConcract.do?cc_uuid='+sessionStorage.id+'&type='+ i,'no']

            });
//            layer.open({
//                type: 2,
//                title: false,
//                closeBtn: 0, //不显示关闭按钮
//                shade: [0],
//                area: ['340px', '215px'],
//                offset: 'rb', //右下角弹出
//                time: 2000, //2秒后自动关闭
//                anim: 2,
//                content: [urls+'/api/print/printConcract.do?cc_uuid='+sessionStorage.id, 'no'], //iframe的url，no代表不显示滚动条
//                end: function(){ //此处用于演示
//                    layer.open({
//                        type: 2,
//                        title: '很多时候，我们想最大化看，比如像这个页面。',
//                        shadeClose: true,
//                        shade: false,
//                        maxmin: true, //开启最大化最小化按钮
//                        area: ['893px', '600px'],
//                        content: urls+'/api/print/printConcract.do?cc_uuid='+sessionStorage.id
//                    });
//                }
//            });

        })





    }
    
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date1'      //开始时间
        });
        laydate.render({
            elem: '#date2'  //结束时间
        });

        ajaxs('/api/contract/loadContractDetails.do','post',{'uuid':sessionStorage.id,'p':getCookie('yanzheng')},           function
            (data) {
            console.log(data)
            var gongchenggaikuo='';
            var datas=data.data[0][0]                     //获取详情
            console.log(data.data)
            if (datas.c_type && datas.c_type === 1){
                gongchenggaikuo = datas.c_build || '';
                datas.gcfy = datas.c_price;
            }else {
                for(var i=0;i<data.data[2].length;i++){
                    console.log(data.data[2][i].cc_cname,data.data[2][i].cc_cnum)
                    gongchenggaikuo+=data.data[2][i].cc_cname;
                    gongchenggaikuo+=':';
                    gongchenggaikuo+=data.data[2][i].cc_cnum+'('+data.data[2][i].cc_cbit+')';
                    gongchenggaikuo+='&nbsp;&nbsp;&nbsp;&nbsp;';
                }
            }
            console.log(gongchenggaikuo)
            switch (datas.state){
                case -1:
                    datas.state='等待审核';
                    break;
                case 0:
                    datas.state='审核通过';
                    break;
                case 1:
                    datas.state='审核未通过';
                    break
            }
            if(!datas.gcfy){
                datas.gcfy='';
            }


            $('.titles').html('编号:'+datas.cc_Code)
            var gongC='';
            for(var i=0;i<data.data[2].length;i++){
                gongC+=data.data[2][i].cc_cname+','+data.data[2][i].cc_cprice+','+data.data[2][i].cc_cnum+data.data[2][i].cc_cbit+','+'&nbsp;&nbsp;'
            }

            $('.details').append('<ul>\n' +
                '                <li><span class=\'detaL\'>工程名称：</span><span class="dataR">  '+datas.eppName+' </span></li>\n' +
                '                <li><span class=\'detaL\'>计划开工日期：</span><span class="dataR">'+shijians(datas.preStaTime)+'</span></li>\n' +
                '                <li><span class=\'detaL\'>起止点：</span><span class="dataR"> '+datas.eppStaEnd+'</span></li>\n' +
                '                <li><span class=\'detaL\'>计划竣工日期：</span><span class="dataR">  '+shijians(datas.preEndTime)+' </span></li>\n' +
                '                <li><span class=\'detaL\'>建设单位（甲方）：</span><span class="dataR">'+datas.compJs+'</span></li>\n' +
                '                <li><span class=\'detaL\'>建设单位项目负责人：</span><span class="dataR">'+datas.director+'</span></li>\n' +

                '                <li><span class=\'detaL\'>建设单位联系方式：</span><span class="dataR">  '+datas.dmotel+' </span></li>\n' +
                '                <li><span class=\'detaL\'>委托设计单位：</span><span class="dataR"> '+datas.compName0+'</span></li>\n' +
                '                <li><span class=\'detaL\'>施工单位（乙方）：</span><span class="dataR"> '+datas.compName1+' </span></li>\n' +

                '                <li><span class=\'detaL\'>施工单位项目负责人：</span><span class="dataR">'+datas.compPerson1+'</span></li>\n' +

                '                <li><span class=\'detaL\'>施工单位联系方式：</span><span class="dataR">'+datas.compTel1+'</span></li>\n' +
                '            </ul>');
        $('.detailed').append('<p><span class="detaL">工程概括(规划位置、主要工程量)</span><span class="dataR">'+gongchenggaikuo+'</span></p>\n' +
            '                <p><span class="detaL">合同单价</span><span class="dataR">'+datas.cc_Price+'</span></p>\n' +
            '                <p class="bucuo"><span class="detaL">工程费用</span><span class="dataR">'+datas.gcfy+'</span></p>\n' +
            '                <p><span class="detaL">决算方式</span><span class="dataR">'+datas.cc_CostType+'</span></p>\n' +
            '                <p><span class="detaL">材料供应</span><span class="dataR">'+datas.cc_Material+'</span></p>' +
                            ' <p><span class="detaL">工程质量</span><span class="dataR">'+datas.cc_BuildMass+'</span></p>\n' +
                '            <p><span class="detaL">安全施工</span><span class="dataR">'+datas.cc_Security+'</span></p>\n' +
                '            <p><span class="detaL">文明、环保施工</span><span class="dataR">'+datas.cc_Culture+'</span></p>\n' +
                '            <p><span class="detaL">竣工验收</span><span class="dataR">'+datas.cc_FinVe+'</span></p>\n' +
                '            <p><span class="detaL">质保期限</span><span class="dataR">'+datas.cc_WarrantyTime+'</span></p>\n' +
            '            <p><span class="detaL">其他</span><span class="dataR">'+datas.cc_Other+'</span></p>' +
            '            <p><span class="detaL">审核状态</span><span class="dataR">'+datas.state+'</span></p>' +
            '<div class="detailedfoot">\n' +
            '            <ul>\n' +
            '                <li><span class=\'detaL\'>建设单位（甲方）：</span><span class="dataR">'+datas.compJs+'</span></li>\n' +
            '                <li><span class=\'detaL\'>施工单位（乙方）：</span><span class="dataR">'+datas.compName1+'</span></li>\n' +
            '                <li><span class=\'detaL\'>委托代理人：</span><span class="dataR">'+datas.director+'</span></li>\n' +
            '                <li><span class=\'detaL\'>委托代理人：</span><span class="dataR">'+datas.compPerson1+'</span></li>\n' +
            '                <li><span class=\'detaL\'>日期：</span><span class="dataR"> '+shijians(datas.sign_Time)+'  </span></li>\n' +
            '                <li><span class=\'detaL\'>日期：</span><span class="dataR"> '+shijians(datas.sign_Time)+'  </span></li>\n' +


            '            </ul>\n' +
            '        </div>');



//        $('.detailedfoot').append()
})



    })

</script>
</body>
</html>